﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Provenance.Domain.DeepProcess;
using Provenance.ErrorCount;
using Provenance.Read.Api.Application.Command.DeepProcess;

namespace Provenance.Read.Api.Controllers
{
    [Route("api/deepprocess/[controller]/[action]")]
    [ApiController]
    public class DeepProcessController : ControllerBase
    {
        private readonly IMediator _mediator;
        public DeepProcessController(IMediator mediator)
        {
            _mediator = mediator;
        }
        [HttpGet]
        public async Task<ApiResult<DeepProcessInfo>> BackDeepProcessInfo([FromQuery]int pid)
        {
            return await _mediator.Send(new BackDeepProcessInfoCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<RowMaterial>> BackRowMaterial([FromQuery]int pid)
        {
            return await _mediator.Send(new BackRowMaterialCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<AuxiliaryMaterial>> BackAuxiliaryMaterial([FromQuery]int pid)
        {
            return await _mediator.Send(new BackAuxiliaryMaterialCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<Additive>> BackAdditive([FromQuery] int pid)
        {
            return await _mediator.Send(new BackAdditiveCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<PackagingMaterial>> BackPackagingMaterial([FromQuery] int pid)
        {
            return await _mediator.Send(new BackPackagingMaterialCommand()
            {
                ProductInfoId = pid
            });
        }
        [HttpGet]
        public async Task<ApiResult<DeepProcessEnterprise>> BackDeepProcessEnterprise([FromQuery] int pid)
        {
            return await _mediator.Send(new BackDeepProcessEnterpriseCommand()
            {
                ProductInfoId = pid
            });
        }






    }
}
